home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "UserComputerName"
- Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
- Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
- Private s$, sz&, cnt&, dl&
-
- Public Function UserName()
- cnt& = 200
- s$ = String$(200, 0)
- dl& = GetUserName(s$, cnt&)
- UserName = UCase(Left$(s$, cnt&))
- End Function
-
- Public Function ComputerName()
- cnt& = 200
- s$ = String$(200, 0)
- dl& = GetComputerName(s$, cnt&)
- ComputerName = UCase(Left$(s$, cnt&))
- End Function
-